﻿namespace GX
{
    static public class TickManager
    {
        static ITickManager _mgr;
        static ITickManager mgr
        {
            get {
                if (null == _mgr)
                    _mgr = App.GetService(App.SERVICE_TICK_MANAGER) as ITickManager;
                return _mgr;
            }
        }

        static public int frameCount { get { return mgr.frameCount; } }
        static public int time { get { return mgr.time; } }
        static public int deltaTime { get { return mgr.deltaTime; } }
        static public int realTime { get { return mgr.realTime; } }
        static public int deltaRealTime { get { return mgr.deltaRealTime; } }

        static public void Update(int frameCount, float time, float realTime)
        {
            mgr.Update(frameCount, time, realTime);
        }
        static public int Tick(int interval, int repeatCount, TickDelegate del, int startDelay, bool isRealtime = false)
        {
            return mgr.Tick(interval, repeatCount, del,startDelay,isRealtime);
        }
        static public int Repeat(int interval, int repeatCount, TickDelegate del, bool isRealtime = false)
        {
            return mgr.Tick(interval, repeatCount, del, 0, isRealtime);
        }
        static public int Forever(int interval,TickDelegate del, bool isRealtime = false)
        {
            return mgr.Tick(interval, 0, del, 0, isRealtime);
        }
        static public int Delay(int interval, TickDelegate del, bool isRealtime = false)
        {
            return mgr.Tick(interval, 1, del, 0, isRealtime);
        }
        static public bool Cancel(int tickID)
        {
            return mgr.Cancel(tickID);
        }
    }
}
